set mem 500m
use "UT08p_likelyvotersample.dta", clear

xi: logit prim06 prim gen rx_p_age i.Republican*i.reg5 if age>=20
est store model3
predict model3
lstat
lroc

hist model3

gen probability = model3
recode probability (min/max=0) if Sample1==1

set seed 3676588
gsample prob_sample, size(probability) ncases(2050)

hist probability, by(prob_sample)

gen srs=1 if sampleall==1 & prob_sample==0

hist model3 if srs==1
hist model3 if prob_sample==1
hist model3

replace model3=0 if model3==.
